package com.ruoyi.image.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.ruoyi.baoziyi.controller.BZYController;
import com.ruoyi.baoziyi.domain.SelectBZYImgInfo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inducePest.controller.InducePest.InducePestImgController;
import com.ruoyi.inducePest.domain.inducePest.SelectInducePestImgInfo;
import com.ruoyi.inducePest.mapper.device.InduceDeviceMapper;
import com.ruoyi.inducePest.service.inducePest.InducePestCaptureImgService;
import com.ruoyi.traplight.controller.TrapLightController;
import com.ruoyi.traplight.domain.SelectPhotoDao;
import com.ruoyi.traplight.mapper.TrapLightDataMapper;
import com.ruoyi.traplight.service.PhotoService;
import com.ruoyi.traplight.service.TrapLightDeviceService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("所有设备图片类")
@Slf4j
@RestController
@RequestMapping("/allDeviceImage")
public class AllDeviceImageController extends BaseController {

    @Autowired
    private TrapLightController trapLightController;

    @Autowired
    private InducePestImgController inducePestImgController;

    @Autowired
    private BZYController bzyController;

    @Autowired
    private InducePestCaptureImgService inducePestCaptureImgService;

    @Autowired
    private InduceDeviceMapper induceDeviceMapper;

    @Autowired
    private TrapLightDeviceService deviceService;

    @Autowired
    private PhotoService photoService;

    @Autowired
    private TrapLightDataMapper dataMapper;

    @GetMapping("/selectImageByCategory")
    public TableDataInfo getPhotoByCategory(Integer typeId, SelectPhotoDao photoDao, SelectInducePestImgInfo inducePestImgInfo, SelectBZYImgInfo selectBZYImgInfo, Integer pageNum, Integer pageSize) throws JsonProcessingException {
        if(typeId == 1){
            return  trapLightController.getPhotoByDate(photoDao);
        }
        else if(typeId == 2){
            return  inducePestImgController.getInfoByCondition(inducePestImgInfo,pageNum,pageSize);
        }else {
            return bzyController.getBZYPhotoByDate(selectBZYImgInfo);
        }
    }

}
